/*
package com.maven.front.exception;

import com.maven.front.bean.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

@Slf4j
@ControllerAdvice
public class MyException {

    @ResponseBody
    @ExceptionHandler
    public Result defaultError(HttpServletResponse response, Exception e){
        String message = e.getMessage();
        Result result = new Result();
        if(message.indexOf("Request method")>=0){
            result.setCode(401);
            result.setMessage("请求方式不匹配");
        }else if(message.indexOf("40001")>=0){
            log.info("40001错误");
            result.setCode(40001);
            result.setMessage("地址不带token");
        }else if(message.indexOf("40002")>=0){
            result.setCode(40002);
            result.setMessage("无效token");
        }else{
            result.setCode(400);
            result.setMessage("其他错误");
        }
        return result;
    }
}
*/
